﻿using System;
using System.Collections.Generic;
using System.Text;

namespace MyLibrary.Data.DatabaseMonitor
{
    /// <summary>
    /// 监控器完成监控时的回调句柄
    /// </summary>
    public delegate void DatabaseMonitorEventHandler(DatabaseMonitorEventArgs e);

    /// <summary>
    /// 所有数据库监控器必须实现的接口
    /// </summary>
    public interface IDatabaseMonitor
    {
        /// <summary>
        /// 单监控完成时触发,报告监控的结果
        /// </summary>
        event DatabaseMonitorEventHandler AfterMonitor;

        /// <summary>
        /// 日志的路径
        /// </summary>
        string LogPath
        {
            get;
            set;
        }

        /// <summary>
        /// 服务器IP地址
        /// </summary>
        string ServerIP
        {
            get;
        }

        /// <summary>
        /// 数据库连接字符串
        /// </summary>
        string DBConnectionStrng
        {
            get;
            set;
        }

        /// <summary>
        /// 数据库监控的时间间隔
        /// </summary>
        int Interval
        {
            get;
            set;
        }

        /// <summary>
        /// 数据库监控的名称
        /// </summary>
        string MonitorName
        {
            get;
        }

        /// <summary>
        /// 监控的表名
        /// </summary>
        string TableName
        {
            get;
            set;
        }
        /// <summary>
        /// 监视器的状态
        /// </summary>
        MonitorStatus Status
        {
            get;
        }
        /// <summary>
        /// 进行数据库监控,触发AfterMonitor事件
        /// </summary>
        void Monitor(object objState);

        /// <summary>
        /// 打开数据库监视器
        /// </summary>
        /// <param name="monitorName">监控器的名称</param>
        void Start();

        /// <summary>
        /// 关闭数据库监视器
        /// </summary>
        void Stop();

        /// <summary>
        /// 暂停监视器
        /// </summary>
        void Pause();

        /// <summary>
        /// 继续监视器
        /// </summary>
        void Continue();
    }
}
